package testdemo.dao.impl;

import edu.nf.SQLExecutor;
import edu.nf.beans.annotations.Component;
import edu.nf.handler.BeanHandler;
import testdemo.dao.UsersDao;
import testdemo.model.Users;
import testdemo.utils.ConnUtil;
import testdemo.model.Users;

@Component("userDao")
public class UsersDaoImpl implements UsersDao{

    @Override
    public Users findUser(String userName, String password) {
        String sql = "SELECT * FROM USER_INFO WHERE U_NAME = ? AND U_PASSWORD = ?";
        SQLExecutor se = new SQLExecutor(ConnUtil.getConnection());
        BeanHandler<Users> handler = new BeanHandler<Users>(Users.class);
        return se.executeQuery(sql, handler, userName, password);
    }

}
